<?php

namespace common\models\myhtsq;

use common\models\BaseModel;

/**
 * 合同文档信息model
 * @author wangwx 2015-05-18
 */
class ContractDocumentModel extends BaseModel
{

    public $document_id;//文档ID
    public $contract_id;//合同ID
    public $pigeonhole_date;//文档归档日期
    public $document_name;//文档名称
    public $keeper;//保管人
    public $contract_document_type;//纸质合同类型
    public $document_ext_name;//文件类型
    public $document_type;//文档类型
    public $document_path;//存放路径
    public $document_dir;//所属文件夹名称
    public $created_on;//创建时间
    public $created_by;//创建人
    public $modified_on;//修改时间
    public $modified_by;//修改人

    public function __construct($config = array())
    {
        parent::__construct($config);
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            //新增合同文档信息
            [['pigeonhole_date', 'created_on', 'modified_on'], 'safe', 'on' => 'add'],
            [['document_id', 'contract_id', 'keeper', 'created_by', 'modified_by'], 'string', 'max' => 36, 'on' => 'add'],
            [['document_name'], 'string', 'max' => 100, 'on' => 'add'],
            [['contract_document_type'], 'string', 'max' => 30, 'on' => 'add'],
            [['document_ext_name'], 'string', 'max' => 10, 'on' => 'add'],
            [['document_type'], 'string', 'max' => 10, 'on' => 'add'],
            [['document_path'], 'string', 'max' => 500, 'on' => 'add'],
            [['document_dir'], 'string', 'max' => 150, 'on' => 'add'],

            //新增合同文档信息
            [['document_id', 'contract_id', 'keeper'], 'required', 'on' => 'update'],
            [['pigeonhole_date', 'created_on', 'modified_on'], 'safe', 'on' => 'update'],
            [['document_id', 'contract_id', 'keeper', 'created_by', 'modified_by'], 'string', 'max' => 36, 'on' => 'update'],
            [['document_name'], 'string', 'max' => 100, 'on' => 'update'],
            [['contract_document_type'], 'string', 'max' => 30, 'on' => 'update'],
            [['document_ext_name'], 'string', 'max' => 10, 'on' => 'update'],
            [['document_type'], 'string', 'max' => 10, 'on' => 'update'],
            [['document_path'], 'string', 'max' => 500, 'on' => 'update'],
            [['document_dir'], 'string', 'max' => 150, 'on' => 'update']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'document_id' => '文档ID',
            'contract_id' => '合同ID',
            'pigeonhole_date' => '文档归档日期',
            'document_name' => '文档名称',
            'keeper' => '保管人',
            'contract_document_type' => '纸质合同类型',
            'document_ext_name' => '文档类型',
            'document_path' => '存放路径',
            'document_dir' => '所属文件夹名称',
            'created_on' => '创建时间',
            'created_by' => '创建人',
            'modified_on' => '修改时间',
            'modified_by' => '修改人',
        ];
    }

}
